<template>
  <div class="con_box">
    <div class="com_title">车辆基本信息</div>
    <!-- 列表 -->
    <div class="orderList">
      <div class="flex">
        <div class="orderItem">
          <div class="orderItem_content">
            <div class="orderItem_data">
              <div class="order_label">车架号</div>
              <div class="txt">{{ dataSource.customerName }}</div>
            </div>
            <div class="orderItem_data">
              <div class="order_label">所属维修中心</div>
              <div class="txt">{{ dataSource.serverName }}</div>
            </div>
            <div class="orderItem_data">
              <div class="order_label">上牌时间</div>
              <div class="txt">{{ dataSource.carModel }}</div>
            </div>
            <div class="orderItem_data">
              <div class="order_label">车牌号</div>
              <div class="txt">{{ dataSource.dateIn }}</div>
            </div>
            <div class="orderItem_data">
              <div class="order_label">所属服务顾问</div>
              <div class="txt">{{ dataSource.dateIn }}</div>
            </div>
            <div class="orderItem_data">
              <div class="order_label">待使用卡券</div>
              <div class="txt">{{ dataSource.dateIn }}</div>
            </div>
            <div class="orderItem_data">
              <div class="order_label">车型</div>
              <div class="txt">{{ dataSource.dateIn }}</div>
            </div>
            <div class="orderItem_data">
              <div class="order_label">最近进场时间</div>
              <div class="txt">{{ dataSource.dateIn }}</div>
            </div>
            <div class="orderItem_data">
              <div class="order_label">车辆来源</div>
              <div class="txt">{{ dataSource.dateIn }}</div>
            </div>
            <div class="orderItem_data">
              <div class="order_label">最近进场里程数</div>
              <div class="txt">{{ dataSource.carMiles }}km</div>
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import { Search, DropdownMenu, DropdownItem, Empty, Dialog } from 'vant'
import carApi from '@/api/carApi'

export default {
  name: 'carBasicInfo',
  components: {
    Search,
    DropdownMenu,
    DropdownItem,
    Empty,
    Dialog,
  },
  data() {
    return {
      dataSource: {},
    }
  },
  props: {
    carId: {
      type: String,
      default: null,
    },
  },

  watch: {
    carId: {
      handler: function (val, oldVal) {
        if (val) {
          console.log(val)
          this.getDetail(val)
        }
      },
      deep: true,
      immediate: false,
    },
  },

  mounted() {},

  methods: {
    getDetail(id) {
      carApi.getCarInfoBase({ id }).then((res) => {
        if (res.code == 1) {
          this.dataSource = res.data
        }
      })
    },
  },
}
</script>

<style lang="less" scoped="">
.con_box {
  width: 7.5rem;
  height: 5.5rem;
  background: #fff;
  margin-right: 0.2rem;
  box-sizing: content-box;
}
.com_title {
  position: relative;
  background: #dcdcdc;
  font-size: 0.32rem;
  padding: 0.2rem;
  &::before {
    content: '';
    background: #409eff;
    width: 4px;
    position: absolute;
    height: 20px;
    top: 7px;
    left: 0;
  }
}
.orderList {
  overflow: hidden;
  width: 7.5rem;
  box-sizing: border-box;
  .taskCheck {
    margin-right: 0.1rem;
  }
  .orderItem {
    padding: 0.3rem;
    border-radius: 10px;
    margin-bottom: 0.3rem;
    .orderItem_header {
      display: flex;
      justify-content: space-between;
      align-items: center;
      margin-bottom: 0.3rem;
      padding-bottom: 0.2rem;
      border-bottom: 1px solid #f6f6f6;
      position: relative;
      .orderItem_lt {
        .carNo {
          font-size: 0.3rem;
          color: #333;
          margin-right: 0.2rem;
          font-weight: bold;
        }

        .carStatus {
          background: #35bc04;
          color: #fff;
          border-radius: 4px;
          padding: 0.1rem 0.2rem;
          font-size: 0.24rem;
          text-align: center;
          width: 1rem;
          margin-top: 0.1rem;
        }
      }
      .orderItem_rt {
        display: flex;
        align-items: center;
        align-self: center;
        justify-content: flex-start;
        color: #666;
        font-size: 0.28rem;

        .txt {
          font-size: 0.28rem;
          color: #161616;
        }
        .icon-tel {
          color: #fff;
          background: #35bc04;
          font-size: 0.32rem;
          padding: 0.1rem;
          border-radius: 50%;
          margin-right: 0.2rem;
        }
        .icon-wx {
          color: #409eff;
          font-size: 0.65rem;
        }
      }
    }
    .orderItem_content {
      display: flex;
      justify-content: flex-start;
      flex-wrap: wrap;
      align-items: center;
      .orderItem_data {
        width: 33%;
        margin-bottom: 0.2rem;
        font-size: 0.28rem;
        box-sizing: content-box;
        color: #333;
        margin-bottom: 0.2rem;
        .order_label {
          font-size: 0.28rem;
          color: #999;
          width: 1.8rem;
          margin-bottom: 0.2rem;
        }
        .txt {
          font-size: 0.28rem;
          color: #333;
          white-space: nowrap;
          overflow: hidden;
          text-overflow: ellipsis;
        }
        &.time {
          width: 100%;
        }
      }
    }
    .orderItem_file {
      background: #ebebeb;
      color: #333;
      border-radius: 5px;
      padding: 0.2rem 0;
      text-align: center;
      width: 100%;
      font-size: 0.28rem;
      display: flex;
      align-items: center;
      justify-content: center;
      .file_item {
        width: 33.33%;
        border-right: 1px solid #ccc;
        .icon-tel {
          font-size: 0.34rem;
          color: #35bc04;
          margin-right: 0.1rem;
        }
        .icon-mileage {
          font-size: 0.4rem;
          color: #409eff;
          margin-right: 0.1rem;
          position: relative;
          top: 0.04rem;
        }
        .icon-gw {
          font-size: 0.4rem;
          color: #409eff;
          margin-right: 0.1rem;
          position: relative;
          top: 0.04rem;
        }
        &:last-child {
          border: none;
        }
      }
    }
  }
}

.noContent {
  margin-top: 2rem;
}
/deep/.van-dropdown-item {
  width: 7.5rem;
}
</style>
